from langchain.agents.factory import create_agent
from langchain_core.output_parsers import JsonOutputParser
from pydantic import BaseModel, Field
from common import calc_tools, llm


class Output(BaseModel):
    args: str = Field("输入的参数")
    result: str = Field("计算的结果")


parser = JsonOutputParser(pydantic_object=Output)
format_instructions = parser.get_format_instructions()
print(format_instructions)

# # 创建 agent
# agent = create_agent(
#     model=llm,
#     tools=calc_tools
# )

# # 运行 agent
# resp = agent.invoke({"messages": [{"role": "user", "content": "计算100+100"}]})
# print(resp)
